#include <iostream>
#include <string>
#include <algorithm>

/**
 * PAT A 1040 Longest Symmetric String
 */

std::string input;
static int buf[1024][1024];

inline int reverse(int i) {
    return input.length() - 1 - i;
}

int main() {
    std::getline(std::cin, input);
    int maxLen = 0;
    for (int i = 0; i <= input.length(); i++)
        buf[0][i] = 0;
    for (int i = 1; i <= input.length(); i++) {
        buf[i][0] = 0;
        char forwChar = input[i - 1];
        for (int j = 1; j <= input.length(); j++) {
            char revChar = input[reverse(j - 1)];
            if (forwChar == revChar) {
                buf[i][j] = buf[i - 1][j - 1] + 1;
                maxLen = std::max(buf[i][j], maxLen);
            } else
                buf[i][j] = 0;
        }
    }
    printf("%d\n", maxLen);
}